﻿CREATE TABLE [dbo].[PaymentRequest] (
    [Id]                       UNIQUEIDENTIFIER ROWGUIDCOL NOT NULL,
    [RefNumber]                NVARCHAR (50)    NOT NULL,
    [PaymentRqstType]          NVARCHAR (50)    NOT NULL,
    [VoucherNumber]            NVARCHAR (50)    NULL,
    [RequestDate]              DATE             NULL,
    [Subject]                  NTEXT            NOT NULL,
    [TotalAmount]              MONEY            NOT NULL,
    [PurchaseOrderId]          UNIQUEIDENTIFIER NULL,
    [RequestForAdvanceId]      UNIQUEIDENTIFIER NULL,
    [TravelAuthorisationId]    UNIQUEIDENTIFIER NULL,
    [SPMId]                    UNIQUEIDENTIFIER NULL,
    [CurrencyId]               UNIQUEIDENTIFIER NOT NULL,
    [SupplierId]               UNIQUEIDENTIFIER NOT NULL,
    [RequestFor]               NVARCHAR (MAX)   NOT NULL,
    [PaymentTermId]            UNIQUEIDENTIFIER NOT NULL,
    [PaymentTypeId]            UNIQUEIDENTIFIER NOT NULL,
    [Remarks]                  NTEXT            NULL,
    [PreparedBy]               UNIQUEIDENTIFIER NOT NULL,
    [ReviewedBy]               UNIQUEIDENTIFIER NULL,
    [AuthorizedBy]             UNIQUEIDENTIFIER NULL,
    [IsReviewed]               BIT              NULL,
    [IsAuthorized]             BIT              NULL,
    [ReviewedOn]               DATETIME         NULL,
    [AuthorizedOn]             DATETIME         NULL,
    [PreparedOn]               DATETIME         NOT NULL,
    [RejectedReviewRemarks]    NVARCHAR (250)   NULL,
    [RejectedAuthorizeRemarks] NVARCHAR (250)   NULL,
    [RecordCount]              BIGINT           IDENTITY (1, 1) NOT NULL,
    [CountryProgrammeId]       UNIQUEIDENTIFIER NOT NULL
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Purpose of the payment', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'PaymentRequest', @level2type = N'COLUMN', @level2name = N'Subject';

